package com.example.demo.common;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;

import java.util.Date;

/**
 * @Author: wn
 * @date 2022年02月18日 9:47
 */
public class MainDemo {

    public static void main(String[] args) {

        String dateStr1 = "2017-03-01 22:33:23";
        Date date1 = DateUtil.parse(dateStr1);

        String dateStr2 = "2022-02-01 23:33:23";
        Date date2 = DateUtil.parse(dateStr2);

        int res = cn.hutool.core.date.DateUtil.compare(new Date(), date2);
        System.out.println(res);
        long betweenDay = cn.hutool.core.date.DateUtil.between(new Date(), date2, DateUnit.DAY);
        System.out.println(betweenDay);
    }
}
